home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
0292.ZIP
/
DSI-DCAT.ARC
/
DSIREAD.PRG
< prev
next >
Wrap
Text File
|
1985-12-21
|
5KB
|
204 lines
DO WHIL .F.
DSIREAD.PRG (c) 1984 Darwin Systems, Inc.
AUTHOR: P. L. Olympia, Ph.D. -07/15/84-
PURPOSE: Program reads the directory of disk then
extracts the diskname, # of bytes free & used
loads these info to DIRDISK.DBF. Then it extracts
the file-specific data and load these into DIRFILE
Program is called by (and returns to) DSIdCAT.PRG
ENDDO whil .F.
PUBL mdisk,mdir,mdiskname,bell
mdisk=TRIM(mdisk)
* Read the disk directory
DO WHIL .T.
CLEAR
? 'Mount disk in '+mdisk
WAIT 'Press X to eXit. Any other key to continue ..' TO x
IF x$'xX'
RETU
ENDIF
* Start reading disk
nsubdir=0
root=.T.
subname=' '
DO WHIL root .OR. nsubdir>0
IF nsubdir>0
nsubc=STR(nsubdir,1)
subname=subname&nsubc
x=mdisk+'\'+subname
RUN CD &x
ENDIF nsubdir
RUN DIR &mdisk.*.* >&mdir
?
? 'The disk directory is as follows:'
TYPE &mdir
SELE 4
* Get rid of the old records
ZAP
* Append data
APPE FROM &mdir SDF
* Get the disk label
GO 2
mdiskname=SUBSTR(fill3,2,1)+fdate+fill4
* Does this disk have any label?
IF 'no label'$mdiskname
CLEA
? bell+'This disk has no label'
TEXT
C - Continue anyway
L - Label the disk (CLIP.COM assumed to be available)
A - Abort this. Read another disk
ENDT
WAIT 'Pick a letter (C,L,A) ---> ' TO what
what=UPPER(what)
DO CASE
CASE what='C'
CASE what='L'
CLEA
@ 10,0 SAY 'What should be the disk label?' GET mdiskname ;
PICT '!!!!!!!!!!!'
READ
mdiskname=TRIM(mdiskname)
* Place label on disk using CLIP.COM
RUN CLIP &mdisk.&mdiskname
OTHERWISE
EXIT
ENDC
ENDIF no label
mdiskname=TRIM(mdiskname)
IF nsubdir>0
mdiskname=TRIM(mdiskname+'\'+subname)
ENDIF nsubdir
* Has this disk been cataloged before?
CLEA
? 'Checking if disk '+mdiskname+' has been cataloged before ...'
SELE 2
SEEK mdiskname
IF .NOT. EOF()
? bell+'Disk Name '+ mdiskname+ ' already exists in the catalog'
TEXT
C - Continue anyway (previous catalog entries will be deleted)
A - Abort this. Read another disk
ENDT
WAIT 'Pick a letter (C,A) ---> ' TO what
what=UPPER(what)
DO CASE
CASE what='C'
? 'Deleting current entries'
?
SET TALK ON
DELE
PACK
SELE 1
DELE ALL FOR disk=mdiskname
PACK
SET TALK OFF
OTHERWISE
EXIT
ENDC
ENDIF duplicate diskname
SELE 4
DELE
* Get subdirectory name & Delete all blank records
GO 3
DELE
DELE ALL FOR ftype=' ' .AND. fname=' '
DELE ALL FOR SUBSTR(fname,1,1)='.'
* Get # of files
GO BOTT
mnumfiles=VAL(SUBSTR(fname,5,4)+fill1)
mbytesf=VAL(SUBSTR(fbytes,5,2)+fill3+SUBSTR(fdate,1,4))
DELE
* Extract data to load to DSIFILE.DBF
SET FILTER TO .NOT. DELETED()
GO TOP
totbytes=0
DO WHIL .NOT. EOF()
* Is this a subdirectory?
IF SUBSTR(fill2,2,2)='<D'
nsubdir=nsubdir+1
nsubc=STR(nsubdir,1)
x=fname
IF ftype # ' '
X=TRIM(x)+'.'+ftype
ENDIF ftype
subname&nsubc=x
SKIP
LOOP
ENDIF subdirectory
* Is this file an excluded file?
mfile=TRIM(fname)
IF ftype # ' '
mfile=mfile+'.'+ftype
ENDIF ftype
? 'Working on file ... '+mfile
* xclud=.F.
SELE 3
SEEK mfile
IF .NOT. EOF()
SELE 4
SKIP
LOOP
ENDIF not eof
SELE 4
mfbytes=VAL(fbytes)
totbytes=totbytes+mfbytes
mfdate=CTOD(fdate)
SELE 1
APPE BLAN
REPL file WITH mfile, fbytes WITH mfbytes, fdate WITH mfdate
REPL ftime WITH d->ftime, disk WITH mdiskname
SELE 4
SKIP
ENDDO whil not eof
SET FILT TO
SELE 2
APPE BLAN
REPL disk WITH mdiskname, numfiles WITH mnumfiles
REPL bytesfree WITH mbytesf, bytesused WITH totbytes
SELE 4
IF root
root=.F.
totsub=nsubdir
* If there is no subdirectory set up for next disk
IF nsubdir > 0
nsubdir=1
ENDIF nsubdir
ELSE
nsubdir=nsubdir+1
IF nsubdir > totsub
nsubdir=0
ENDIF nsubdir
ENDIF root
ENDDO whil root or subdir
ENDDO WHIL t
RETU